/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author antonio
 */
@Embeddable
public class BuildPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "villager")
    private int villager;
    @Basic(optional = false)
    @NotNull
    @Column(name = "building")
    private int building;

    public BuildPK() {
    }

    public BuildPK(int villager, int building) {
        this.villager = villager;
        this.building = building;
    }

    public int getVillager() {
        return villager;
    }

    public void setVillager(int villager) {
        this.villager = villager;
    }

    public int getBuilding() {
        return building;
    }

    public void setBuilding(int building) {
        this.building = building;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) villager;
        hash += (int) building;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BuildPK)) {
            return false;
        }
        BuildPK other = (BuildPK) object;
        if (this.villager != other.villager) {
            return false;
        }
        if (this.building != other.building) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.BuildPK[ villager=" + villager + ", building=" + building + " ]";
    }
    
}
